#include "NxRunningLogFactory.h"
#include "NxRunningLog.h"

NJGIS::SERVICE::INjRunningLog* NJGIS::SERVICE::NJRunningLogFactory::createRunningLogByJSON(Json::Value &JLog){

	std::string type = JLog["Type"].asString();
	std::string state = JLog["State"].asString();
	std::string event = JLog["Event"].asString();
	int flag = JLog["Flag"].asInt();
	std::string message = JLog["Message"].asString();
	std::string datetime = JLog["Datetime"].asString();

	INjRunningLog* pRl = new NjRunningLog(type.c_str(),state.c_str(),event.c_str(),flag,message.c_str(),datetime.c_str());

	return pRl;
}

void NJGIS::SERVICE::NJRunningLogFactory::convertJson2Logs( Json::Value jsLogs, std::vector<INjRunningLog*>* &logs )
{
	for(int i = logs->size() ; i < jsLogs.size(); i++)
	{
		NJGIS::SERVICE::INjRunningLog* log = NJGIS::SERVICE::NJRunningLogFactory::createRunningLogByJSON(jsLogs[i]);
		logs->push_back(log);
	}
}
